
#ifndef FILECONNECTION_H
#define FILECONNECTION_H

#include "tux.h"

#include "MsnConnection.h"

class MsnSession;

class FileTransferConnection : public MsnConnection
{
protected:
	MsnSession* session;
	wxString cookie;
    wxString authCookie;

	wxString filePath;
	bool cancelled;

	wxSocketServer* serverSocket;

public:
    FileTransferConnection(MsnSession* _session, const wxString& _inviteCookie,  const wxString& _authCookie);

	virtual ~FileTransferConnection(){}

	virtual void ConnectionOpened(){};
    virtual void ConnectionFailed(){};
    virtual void ConnectionClosed(){};
    virtual void ConnectionBroken(){};

	virtual bool Connect(const wxString& hostname,int port);

	int OpenServerSocket(int port);

	void Cancel();

public:
	void SetFilePath(const wxString& path){filePath = path;}
	
};

class FtpFileSender : public FileTransferConnection
{

public:
    FtpFileSender(MsnSession* _session, const wxString& _inviteCookie,  const wxString& _authCookie);
	virtual ~FtpFileSender(){};
	
	void SendFile();

protected:
    virtual void ProcessCommand(const wxString& line);

};


class FtpFileReceiver : public FileTransferConnection
{
public:
    FtpFileReceiver(MsnSession* _session, const wxString& _inviteCookie,  const wxString& _authCookie);
	virtual ~FtpFileReceiver(){};
	
	void ReceiveFile(long fileSize);
	virtual void ConnectionOpened();

protected:
    virtual void ProcessCommand(const wxString& line);

};


#endif
